﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QuanLyHocBongSinhVien.VO;
using QuanLyHocBongSinhVien.DAO;
using System.Data.SqlClient;
using System.Data;

namespace QuanLyHocBongSinhVien.Bus
{
   public class Khoa_Bus
    {
       List<Khoa_VO> list = new List<Khoa_VO>();
       Khoa_DAO k = new Khoa_DAO();
       public DataTable getMaKhoa1()
       {
           return k.getMakhoa();
       }

       public List<Khoa_VO> getAllKhoa()
       {
           DataTable kh = new DataTable();
           List<Khoa_VO> l = new List<Khoa_VO>();
           foreach (DataRow r in kh.Rows)
           {
               Khoa_VO khoa = new Khoa_VO();
               khoa.MaKhoa = r[0].ToString();
               khoa.TenKhoa = r[1].ToString();
               khoa.TruongKhoa = r[2].ToString();
               khoa.SoDT = (int)r[3];
               khoa.email = r[4].ToString();
           }
           return l;
       }

       public DataTable GetAllKhoa()
       {
           return k.getAllKhoa();
       }

       public void Add(string m, string t, string tk, int so, string e)
       {
           k.ThemKhoa(m, t, tk, so, e);
       }

       public void update(string m, string t, string tk, int so, string e)
       {
           k.SuaKhoa(m, t, tk, so, e);
       }
       public void Delete(string m)
       {
           k.XoaKhoa(m);
       }

       public void TimKiemTheoMa(string ma)
       {
           k.TimKiemTheoMa(ma);
       }
       public void TimKiemTheoTen(string ten)
       {
           k.TimKiemTheoTenKhoa(ten);
       }

       public void TimKiemTheoTrKh(string tk)
       {
           k.TimKiemTheoTruongKhoa(tk);
       }
       public void TimKiemTheoemail(string e)
       {
           k.TimKiemTheoEmail(e);
       }
       public void TimKiemTheoSDT( int sdt)
       {
           k.TimKiemTheoSDT(sdt);
       }
               
    }
}
